/**
 * desc: button panel
 * author: Joe
 * date: 8/7/2018
 *
 * button format:
 *   # button
 *   [
 *     {
 *       title,
 *       type, [md-primary]
 *       action,
 *     }
 *   ]
 */

coreModule.component('nButtonPanel', {
  templateUrl: 'components/button-panel/button-panel.template.html',
  restrict: 'E',
  bindings: {
    buttonList: '<'
  },
  controller: function() {
    this.$onInit = function() {
      this.buttonList = this.buttonList || [];
      angular.forEach(this.buttonList, function(btn) {
        btn.action = btn.action || angular.noop;
        btn.type = btn.type || 'md-primary';
      });
    };
  },
});
